package fr.enseirb.mycub.component.map.bike;

import android.graphics.drawable.Drawable;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;

import fr.enseirb.mycub.component.map.OverlayBundleItem;

public class BikeStationOverlay extends OverlayBundleItem {
	
	public static final int NOT_EMPTY = 0;
	public static final int BIKE_EMPTY = 1;
	public static final int FULL_EMPTY = 2;

	private int mId;
	private String mBikes;
	private String mSlots;
	private int status = NOT_EMPTY;

	
	public BikeStationOverlay(GeoPoint point, String bikes, String slots, int id) {
		super(point);
		mId = id;
		mBikes = String.valueOf(bikes);
		mSlots = String.valueOf(slots);
		if(Integer.parseInt(mBikes) == 0 && Integer.parseInt(mSlots) == 0) status = FULL_EMPTY;
		else if(Integer.parseInt(mBikes) == 0 ) status = BIKE_EMPTY;
	}

	@Override
	public Drawable getMarker(int stateBitset) {
		if (BikeStationsOverlay.mDrawText && status == NOT_EMPTY) {
			BikeStationsOverlay.texts_not_empty.bike = mBikes;
			BikeStationsOverlay.texts_not_empty.slots = mSlots;
			return BikeStationsOverlay.texts_not_empty;
		}
		else if (BikeStationsOverlay.mDrawText && status == BIKE_EMPTY) {
			BikeStationsOverlay.texts_bike_empty.bike = mBikes;
			BikeStationsOverlay.texts_bike_empty.slots = mSlots;
			return BikeStationsOverlay.texts_bike_empty;
		}
		else if (BikeStationsOverlay.mDrawText && status == FULL_EMPTY) {
			BikeStationsOverlay.texts_full_empty.bike = mBikes;
			BikeStationsOverlay.texts_full_empty.slots = mSlots;
			return BikeStationsOverlay.texts_full_empty;
		}
		else {
			return BikeStationsOverlay.pin;
		}
	}

	public int getId() {
		return mId;
	}

	public void setId(int id) {
		mId = id;
	}

	public void setBikes(int bikes) {
		mBikes = String.valueOf(bikes);
	}

	public void setSlots(int slots) {
		mSlots = String.valueOf(slots);
	}
}